const { axios } = require('../../../utils/http')

Page({
  data: {
    siteList: []
  },
  onShow() {
    this.getSiteList()
  },
  goSite(e) {
    const url = e.currentTarget.dataset['url']
    const toUrl = url.path || url.name
    console.log(toUrl)

    wx.navigateTo({
      url: '/pages/sources/site/siteWeb/siteWeb?url=' + toUrl
    })
  },
  getSiteList() {
    axios.get('/navigation/search').then(res => {
      console.log(res)
      res.data.error === -1 &&
        this.setData({
          siteList: res.data.data
        })
    })
  }
})
